<template>
  <div class="h-full w-[100%]">
    <div class="flex h-[110px] hjjl_info_box">
      <div class="hjjl_info text-center flex-1">
        <div>产品名称</div>
        <div>{{ activeData?.M1 || "-" }}</div>
      </div>
      <div class="hjjl_info_center text-center flex-1">
        <div>{{ activeData?.M2 || "" }}</div>
      </div>
      <div class="hjjl_info text-center flex-1">
        <div>配方</div>
        <div>{{ activeData?.M3 || "-" }}</div>
      </div>
    </div>
    <el-table
      class="top-table selectOption"
      border
      :data="tableData2"
      style="
        width: calc(100% - 40px);
        margin: 10px auto 0;
        --el-table-border-color: none;
        --el-table-bg-color: none;
        --el-table-tr-bg-color: none;
      "
      :row-class-name="tableRowClassName"
      :cell-style="{
        color: '#FFFFFF',
        'text-align': 'center',
        'font-family': 'DINPro',
      }"
      :header-cell-style="{
        backgroundColor: 'transparent !important',
        backgroundRepeat: 'no-repeat',
        backgroundPosition: 'center',
        backgroundSize: 'auto',
      }"
    >
      <el-table-column label="测量项">
        <template #default="scope">{{ scope.row?.name || "" }} </template>
      </el-table-column>
      <el-table-column label="理论值">
        <template #default="scope"
          ><span v-if="scope.row?.name === '球化剂'">{{
            activeData?.M4 || ""
          }}</span>
          <span v-if="scope.row?.name === '孕育剂'">{{
            activeData?.M6 || ""
          }}</span>
          <span v-if="scope.row?.name === '覆盖剂'">{{
            activeData?.M8 || ""
          }}</span>
        </template>
      </el-table-column>
      <el-table-column label="实际值">
        <template #default="scope">
          <div class="c-[#2ffff3]!">
            <span v-if="scope.row?.name === '球化剂'">{{
              activeData?.M5 || ""
            }}</span>
            <span v-if="scope.row?.name === '孕育剂'">{{
              activeData?.M7 || ""
            }}</span>
            <span v-if="scope.row?.name === '覆盖剂'">{{
              activeData?.M9 || ""
            }}</span>
          </div>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup lang="ts">
defineOptions({
  name: "DATASCREENRL02HJJL",
  inheritAttrs: false,
});

const props = defineProps({
  hjjlData: {
    type: Object,
    default: () => {},
  },
  activeData: {
    type: Object,
    default: () => {},
  },
  refreshRate: {
    type: Number,
    default: () => 0,
  },
});

const { hjjlData, activeData, refreshRate } = toRefs(props);

const tableData2 = ref([
  { name: "球化剂" },
  { name: "孕育剂" },
  { name: "覆盖剂" },
]);
// 行样式解析
function tableRowClassName(rowIndex: any) {
  if (rowIndex.rowIndex % 2 != 0) {
    return "evenRow";
  }
  return "oddRow";
}

onMounted(() => {});

onBeforeUnmount(() => {});
</script>

<style lang="scss" scoped>
// 整体表格样式
:deep(.el-table) {
  thead {
    background: rgba(2, 79, 173, 0.3);
    .cell {
      font-size: 18px;
      line-height: 20px;
      writing-mode: horizontal-tb;
      word-spacing: 0px;
      writing-mode: horizontal-tb;
      text-orientation: upright;
      color: transparent;
      background: linear-gradient(
          0deg,
          rgb(88, 175, 255) 0px,
          rgb(255, 255, 255) 100%
        )
        text;
      clip-path: inset(1px);
      padding: 0 6px;
    }

    tr:nth-last-child(1) {
      border-right: none;
    }
  }
  tbody {
    tr {
      height: 38px;
      .cell {
        font-size: 17px;
        line-height: 21px;
        padding: 0 6px;
      }
    }
    tr:hover {
      background-color: rgb(55, 90, 136) !important;
    }
    td.el-table__cell {
      background-color: transparent !important;
      border: none !important;
    }
  }

  .el-table__empty-text {
    color: rgb(199, 228, 240);
    font-size: 24px;
    line-height: 200px;
  }
}
// 单行样式
:deep(.evenRow) {
  background: rgba(15, 36, 62, 0.6);
  td {
    .cell {
      // color: rgb(104, 201, 240);
      color: rgb(168, 190, 216);
    }
  }
}

// 双行样式
:deep(.oddRow) {
  background: rgba(10, 24, 42, 0.6);
  td {
    .cell {
      color: rgb(168, 190, 216);
    }
  }
}

.jzcp {
  text-align: center;
  font-size: 25px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: -5px;
}

:deep(.syt_chart) {
  thead {
    .cell {
      font-size: 19px !important;
      line-height: 20px;
    }
  }
  tbody {
    tr {
      .cell {
        padding: 0 1px !important;
      }
    }
  }
}

.hjjl_info_box {
  background-image: url("@/assets/images/screen/preview11.png");
  background-size: auto;
  background-repeat: no-repeat;
  background-position: center;
  .hjjl_info {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: center;
    div:nth-child(1) {
      writing-mode: horizontal-tb;
      word-spacing: 0px;
      letter-spacing: 0px;
      text-orientation: upright;
      color: rgba(255, 255, 255, 0.9);
      user-select: text;
      font-size: 20px;
      font-family: YOUSHE;
    }
    div:nth-child(2) {
      writing-mode: horizontal-tb;
      word-spacing: 0px;
      letter-spacing: 0px;
      text-orientation: upright;
      color: transparent;
      background: linear-gradient(
          0deg,
          rgb(1, 94, 234) 0px,
          rgb(0, 192, 250) 100%
        )
        text;
      user-select: text;
      font-family: YOUSHE;
      font-size: 26px;
      line-height: 26px;
    }
  }
  .hjjl_info_center {
    justify-content: center;
    align-items: center;
    div {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100%;
      margin-top: 0px;
      writing-mode: horizontal-tb;
      text-orientation: upright;
      color: rgb(255, 255, 255);
      filter: drop-shadow(rgba(0, 11, 27, 0.66) 1px 1px 0px)
        drop-shadow(rgb(95, 159, 255) 2px 1px 16px);
      user-select: text;
      font-family: YOUSHE;
      font-size: 30px;
    }
  }
}
</style>
